from robot_arm_ik_simple import RobotArmIK

# 创建机械臂实例
arm = RobotArmIK(l1=114, l2=60)
arm.solution_type = 0  # 固定使用肘上解

# 定义多个目标点
target_points = [(100, 30), (120, 50), (80, 20), (150, 40)]

# 批量计算并输出结果
for x, y in target_points:
    arm.target_x = x
    arm.target_y = y
    success = arm.calculate_ik()
    
    if success:
        print(f"目标({x}, {y}): theta1={arm.theta1:.2f}°, theta2={arm.theta2:.2f}°")
    else:
        print(f"目标({x}, {y}): 不可达")